﻿namespace Fiddler.AMF
{
    using System.IO;
    using System.Windows.Forms;

    public partial class AMFViewer : UserControl
    {
        public AMFViewer()
        {
            InitializeComponent();
        }

        public void DisplayRequest(byte[] data)
        {
            var stream = new MemoryStream(data);
            var deserializedObject = new AmfDeserializer(stream);
            var message = deserializedObject.DeserializeRequest();
            labelMethod.Text = message.Version.ToString();
        }

        public void DisplayResponse(byte[] data)
        {
            var stream = new MemoryStream(data);
            var deserializedObject = new AmfDeserializer(stream);
            var message = deserializedObject.DeserializeResponse();
            labelMethod.Text = message.Version.ToString();
        }
    }
}
